﻿using System.Web.Mvc;
using System.Web.Routing;

namespace System.Web.Mvc
{
    public static class MessageHelper
    {
        public static string MessageBody(this HtmlHelper helper, string message)
        {
            var tag = new TagBuilder("p");
            if (message.Length > 66)
            {
                tag.SetInnerText(message.Substring(0, 66)+"...");
                return tag.ToString();
            }
            tag.SetInnerText(message);
            return tag.ToString();
        }
        public static string MessageBody(this HtmlHelper helper, string message, string cssclass)
        {
            var tag = new TagBuilder("p");
            tag.AddCssClass(cssclass);
            if(message.Length > 66)
            {
                tag.SetInnerText(message.Substring(0, 66) + "...");
                return tag.ToString();
            }
            tag.SetInnerText(message);
            return tag.ToString();
        }
    }
}
